$('.form_date').datetimepicker({
	language : 'zh-CN',
	weekStart : 1,
	todayBtn : 1,
	autoclose : 1,
	todayHighlight : 1,
	startView : 2,
	minView : 2,
	forceParse : 0
});
myapp.controller('queryEmployees', [ '$scope', '$http',
		function($scope, $http) {
			$scope.page = {pageNo:1};
			$scope.employee={};
			$scope.contract_status=0;
			$scope.research = function(){
				//强制页码变化
				$scope.page.pageNo=1;
 				$scope.search();
			};
			$scope.pageChanged =function(page){
				$scope.search();
			};
			$scope.search = function() {
				$http({
					method : 'POST',
					url : ctx + '/employee/list.htm',
					data : {
						true_name:$scope.true_name,
						mobile:$scope.mobile,
						id_card:$scope.id_card,
						create_time:$scope.create_time,
						pageNo:$scope.page.pageNo,
						pageSize:$scope.page.pageSize
					} }).success(function(data) {
					if (data.rescode == 200) {
						$scope.page = data.data;
					} else {
						$scope.msg = data.msg;
					}
				});
			};
		    $scope.modify = function(employee){
		    	$scope.employee=employee;
		    	$('#myModal').modal('show');
		    };
		    $scope.view = function(employee){
		    	$scope.employee=employee;
		    	$('#myModal2').modal('show');
		    };
		    $scope.contract = function(employee){
		    	if($scope.contract_status=="0"){
		    		url =ctx + '/employee/contract.htm';
		    	}else  if($scope.contract_status=="1"){
		    		url =ctx + '/employee/discontract.htm';
		    	}else if($scope.contract_status=="2"){
		    		url =ctx + '/employee/reset.htm';
		    	}else{
		    		return;
		    	}
				$http({
					method : 'GET',
					url : url,
					params : {
						user_id : $scope.employee.user_id
					}
				}).success(function(data) {
					if (data.rescode != 200) {
						$scope.msg = data.msg;
					}else{
						var status = (parseInt($scope.employee.contract_status)+1)%3;
						$scope.employee.contract_status= status;
					}
				});
		    };
		} ]);